﻿/// <reference path="Geo.Core.ts" />
/// <reference path="jquery.d.ts" />
/// <reference path="jquerymobile.d.ts" />

////////////////////////////////////////////////
// Created by Michael Kappel March 19th, 2013 //
// "Geo.UI.ts" TypeScript JavaScript          //
// http://www.typescriptlang.org/             //
// Always change Geo.UI.ts                    //
// This is the UI Javscript file for          //
// Geotrackable.mobi                          //
// Requires Geo.Core, jquery, and jquerymobile//
////////////////////////////////////////////////

function displayPosition(position) {
    var p = document.getElementById("p");
    p.innerHTML = "<table border='1'><tr><th>Timestamp</th><td>" + position.timestamp +
    "<tr><th>Latitude (WGS84)</th><td>" + position.coords.latitude + " deg</td></tr>" +
    "<tr><th>Longitude (WGS84)</th><td>" + position.coords.longitude + " deg</td></tr></table>";
}

//***********************[ No jQuery Before This Point ]********************************
Geo.Core.OnAfterInitialize.add(function () {
    $('#lblStatus').html((Geo.Core.Current.IsOnline ? 'Online' : 'Offline') + ' Mode');
});

module Geo.UI {
    //***********************************
    // Load Scripts                             
    //***********************************
    //$.ajaxSetup({
    //    cache: true
    //});
    //var isProduction : bool = !(window.location.href.indexOf('dev.geotracakble.mobi') >= 0 || window.location.href.indexOf('localhost') >= 0);
    //var filePath = window.location.pathname;
    //var extension = (isProduction) ? '.min.js' : '.js'
    //var fileName = '/js/p' + (filePath.substr(3).replace(/\.html/g, extension));
    //if (fileName.indexOf('.js') < 0) {
    //    fileName = fileName + 'index.js';
    //}
    //$(function () {
    //    $.getScript(fileName, function () { Geo.Core.Initialize(isProduction); });
    //});
}



$(document).ready(function($){
    var isProduction : bool = !(window.location.href.indexOf('dev.geotracakble.mobi') >= 0 || window.location.href.indexOf('localhost') >= 0);
    Geo.Core.Initialize(isProduction);
});